<!--
 * @Date: 2023-05-13 19:39:48
 * @LastEditTime: 2023-09-12 17:35:21
 * @FilePath: /wkw/src/views/swapLogs/index.vue
 * 介绍:
-->
<route lang="json">
{
  "meta": {
    "title": "t('dui-huan-ji-lu')"
  }
}
</route>
<script lang="ts" setup>
import { fixedDecimals, omitText } from "@@/utils/tools/format";
import { txidStatus } from "@@/enum/globalEnum";
import { ApiSwapLogs, apiSwapLogs } from "@@/api/transaction/list";
import dayjs from "dayjs";
// code...
type listItemSlot = {
  item: ApiSwapLogs.DataItem;
  index: number;
};
</script>
<template>
  <CpageView>
    <CrequestList :api="apiSwapLogs">
      <template #item="{ item }: listItemSlot">
        <Ccard class="T-S-sm" :key="item.id">
          <Cgrid col="auto 1fr auto">
            <CgridItem>
              <CstateTag :enum="txidStatus" :value="item.status" />
            </CgridItem>
            <CcopyText :copy-text="item.txid">
              {{ omitText(item.txid) }}
            </CcopyText>
            <CgridItem>
              {{ dayjs(item.created_at).format("MM/DD HH:mm") }}
            </CgridItem>
          </Cgrid>
          <VanDivider class="MT-sm MB-sm" />
          <Cgrid col="auto 1fr auto">
            <div>
              <div class="flex-A-C">
                <Rimage size="40rem" :src="item.fromcoin.logo" />
                <div class="ML-xs">{{ item.fromcoin.code }}</div>
              </div>
              <h4 class="T-A-C MT-xs">{{ fixedDecimals(item.number) }}</h4>
            </div>
            <van-icon name="arrow" />
            <div>
              <div class="flex-A-C">
                <Rimage size="40rem" :src="item.tocoin.logo" />
                <div class="ML-xs">{{ item.tocoin.code }}</div>
              </div>
              <h4 class="T-A-C MT-xs">
                {{ fixedDecimals(item.to_number, 4) }}
              </h4>
            </div>
          </Cgrid>
        </Ccard>
      </template>
    </CrequestList>
  </CpageView>
</template>
<style lang="scss" scoped></style>
